package com.h2cloud.clone;

/**
 * @Package: com.h2cloud.clone
 * @ClassName: ArrayClone
 * @Author: h2cloud
 * @CreateTime: 2021/9/28 4:40 下午
 * @Description:
 */
public class ArrayClone {
    public static void main(String[] args) {
        Person p1 = new Person("wangwu", 18);
        Person p2 = new Person("lisi", 28);
        Person[] ps1 = {p1, p2};
        Person[] ps2 = ps1.clone();
        ps2[0].setName("wanghao");
        ps2[0].setAge(22);
        System.out.println("name=" + p1.getName() + ",age=" + p1.getAge());
        //name=wanghao,age=22
    }
}
